﻿using DotNetStar.TheKing.Infrastructure;
using SDDP;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace DotNetStar.TheKing.Domain
{
    /// <summary>
    /// 分类
    /// </summary>
    [Table("Categories")]
    public class Category : IEntity<int>
    {
        [Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required,StringLength(20)]
        public string Name { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Enabled { get; set; } = true;

        public int ParentId { get; set; }
        /// <summary>
        /// 排序，从小到大
        /// </summary>
        public int DisplayOrder { get; set; }
        [NotMapped]
        public IEnumerable<Content> Contents { get; set; } = new HashSet<Content>();
        [NotMapped]
        public Category ParentCategory { get; set; }

        //public long UserId { get; set; }

        //[NotMapped]
        //public User User { get; set; }
    }
}
